#ifndef POLYGONBODY_H
#define POLYGONBODY_H

#include "bodywrapper.h"
#include <vector>
#include <Box2D/Box2D.h>
#include <QPainter>

class PolygonBody : public BodyWrapper
{
public:
    PolygonBody(b2World *world,
                b2BodyType body_type,
                std::vector<b2Vec2> &points,
                b2Vec2 pivot_center,
                float angle_in_radius = 0.f,
                float density = 0.f,
                float friction = 0.f);
    PolygonBody(b2World *world,
                b2BodyType body_type,
                const b2Vec2 *points,
                int size,
                b2Vec2 pivot_center,
                float angle_in_radius = 0.f,
                float density = 0.f,
                float friction = 0.f);

    const std::vector<b2Vec2> &getVertices() {return points;}
    virtual void draw(QPainter *painter) override;
    virtual bool inRegion(int top, int left, int right, int bottom) override;

private:
    void createBody();

private:
    std::vector<b2Vec2> points;
};

#endif // POLYGONBODY_H
